package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	WordTestSummaryEventNew          = "study.WordTestSummaryNew"
	WordTestSummaryEventBeforeCreate = "study.WordTestSummaryBeforeCreate"
	WordTestSummaryEventBeforeUpdate = "study.WordTestSummaryBeforeUpdate"
	WordTestSummaryEventBeforeSave   = "study.WordTestSummaryBeforeCreate study.WordTestSummaryBeforeUpdate"
	WordTestSummaryEventAfterCreate  = "study.WordTestSummaryAfterCreate"
	WordTestSummaryEventAfterUpdate  = "study.WordTestSummaryAfterUpdate"
	WordTestSummaryEventAfterSave    = "study.WordTestSummaryAfterCreate study.WordTestSummaryAfterUpdate"
	WordTestSummaryEventDelete       = "study.WordTestSummaryDelete"

	WordTestSummaryAccessControlEvent = "study.WordTestSummaryAccessControl"
)

func GetWordTestSummaryConfig() *mgo.DocConfig {
	return WordTestSummary_Config
}

var WordTestSummary_Config *mgo.DocConfig

func init() {
	WordTestSummary_Config = NewWordTestSummaryConfig()
}

func NewWordTestSummaryConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "study.WordTestSummary",
		Fields: []string{
			"student", "point", "score",
		},
		RelationFields: []string{
			"student", "point",
		},
		RelationConfigs: map[string]*mgo.DocRelation{

			"student": {
				Config:     GetStudentConfig,
				DocName:    "Student",
				JoinType:   "O",
				KeyInside:  "studentId",
				KeyOutSide: "id",
			},

			"point": {
				Config:     GetReadWriteConfig,
				DocName:    "ReadWrite",
				JoinType:   "O",
				KeyInside:  "pointId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
